package com.example.rabbitextensionsdemo.listener;

import com.example.rabbitextensionsdemo.constant.Constants;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class DelayedListener {
    @RabbitListener(queues = Constants.DELAYED_QUEUE)
    public void delayListener(Message message) {
        System.out.printf("接受到消息 %tc,message: %s\n", new Date(), new String(message.getBody()));
    }

}
